package com.koron.tool.controller;

import com.github.pagehelper.PageInfo;
import com.koron.bean.base.Response;
import com.koron.bean.system.staff.vo.EamUser;
import com.koron.common.core.annocation.CasUser;
import com.koron.tool.bean.ToolStatisticsBean;
import com.koron.tool.bean.ToolStatisticsQuery;
import com.koron.tool.service.ToolAccountStatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.koron.ebs.mybatis.ADOConnection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

/**
 * @Author: liaodf
 * @Date: 2021/10/25 10:48
 */
@Slf4j
@Api(tags = "工器具台账统计")
@RestController
@RequestMapping("/statistics")
public class ToolAccountStatisticsController {

    @Autowired
    private ToolAccountStatisticsService service;

    /**
     * 获取库房下的统计数据
     *
     * @param user 当前用户
     * @return Resposnse对象
     * @version 1.0
     * @see Response
     */
    @ApiOperation(value = "查询库房下的工具统计数据")
    @GetMapping("/getStatistics")
    public Response<ToolStatisticsBean> getStatistics(@CasUser @ApiIgnore EamUser user, String warehouseId) {
        return ADOConnection.runTask(user.getCurrDs(), service, "getStatistics", Response.class, warehouseId);
    }

    /**
     * 获取库房下的工具总数详情
     *
     * @param user 当前用户
     * @return Resposnse对象
     * @version 1.0
     * @see Response
     */
    @ApiOperation(value = "查询库房下的工具总数详情")
    @GetMapping("/getTotalList")
    public Response<PageInfo> getTotalList(@CasUser @ApiIgnore EamUser user, ToolStatisticsQuery query) {
        return ADOConnection.runTask(user.getCurrDs(), service, "getTotalList", Response.class, query);
    }

    /**
     * 获取库房下的工具在库数详情
     *
     * @param user 当前用户
     * @return Resposnse对象
     * @version 1.0
     * @see Response
     */
    @ApiOperation(value = "查询库房下的工具在库数详情")
    @GetMapping("/getInWarehouseList")
    public Response<PageInfo> getInWarehouseList(@CasUser @ApiIgnore EamUser user, ToolStatisticsQuery query) {
        return ADOConnection.runTask(user.getCurrDs(), service, "getInWarehouseList", Response.class, query);
    }


    /**
     * 获取库房下的工具在库数详情
     *
     * @param user 当前用户
     * @return Resposnse对象
     * @version 1.0
     * @see Response
     */
    @ApiOperation(value = "查询库房下的工具出库数详情")
    @GetMapping("/getOutWarehouseList")
    public Response<PageInfo> getOutWarehouseList(@CasUser @ApiIgnore EamUser user, ToolStatisticsQuery query) {
        return ADOConnection.runTask(user.getCurrDs(), service, "getOutWarehouseList", Response.class, query);
    }


    /**
     * 获取库房下的工具待检验数详情
     *
     * @param user 当前用户
     * @return Resposnse对象
     * @version 1.0
     * @see Response
     */
    @ApiOperation(value = "查询库房下的工具待检验数详情")
    @GetMapping("/getToInspectionList")
    public Response<PageInfo> getToInspectionList(@CasUser @ApiIgnore EamUser user, ToolStatisticsQuery query) {
        return ADOConnection.runTask(user.getCurrDs(), service, "getToInspectionList", Response.class, query);
    }

    /**
     * 获取库房下的工具报废数详情
     *
     * @param user 当前用户
     * @return Resposnse对象
     * @version 1.0
     * @see Response
     */
    @ApiOperation(value = "查询库房下的工具报废数详情")
    @GetMapping("/getScrapList")
    public Response<PageInfo> getScrapList(@CasUser @ApiIgnore EamUser user, ToolStatisticsQuery query) {
        return ADOConnection.runTask(user.getCurrDs(), service, "getScrapList", Response.class, query);
    }

}
